load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(":toolchain_test.bzl", "toolchain_test_suite")

toolchain_test_suite(name = "toolchain_test_suite")

genrule(
    name = "inspect",
    outs = ["rustc-cfg"],
    # rustc assumes it can read things like librustc_driver in order to run this command.
    # This is a test to ensure we supply all of the files rustc needs as part of the current_rust_toolchain.
    cmd = "$(RUSTC) --print=cfg > $@",
    toolchains = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
    tools = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
)

build_test(
    name = "inspect_build_test",
    targets = [":inspect"],
)
